var prefs = new gadgets.Prefs();
var lang = prefs.getMsg("Lang");
var customCSSForCards = "https://sites.google.com/site/scriptsexamples/awesome_table_multipleColumnsLayout.css?attredirects=0";
$(function () {
  $("[data-toggle='tooltip']").tooltip();
});

function displayParameters() {
  var locale_en = {
    config: {
      "label_tab_sheet": "Sheet",
      "label_tab_view": "View",
      "label_tab_format": "Format",
      "label_tab_advanced_parameters": "Advanced parameters",
      "button_save": "Save",
      "label_input_url": "Google Sheet URL",
      "label_input_sheet": "Sheet name",
      "label_input_range": "Range",
      "label_visualizationType_Table": "Table",
      "label_visualizationType_Table_abbrTitle": "Default view",
      "label_visualizationType_Maps": "Maps",
      "label_visualizationType_Maps_abbrTitle": "Displays data on a Google Maps, requires geo coordinates / addresses for each data row",
      "label_input_pageSize": "Number of items to display",
      "label_input_pageSize_abbrTitle": "The results are paginated",
      "label_input_columnsLayout": "Number of columns",
      "label_input_hasSidebar ": "Display data in a sidebar",
      "label_input_hasSidebar_abbrTitle": "Useful when you need to display a lot of data",
      "label_input_sidebarColumn": "Column index",
      "label_input_categoryCaption": "The caption to display inside the category filter when no item is selected",
      "value_input_categoryCaption": "Choose a value...",
      "label_input_backgroundColor": "The background color of your page",
      "label_input_dateFormat": "Date format",
      "label_input_customCSS": "Custom CSS (URL)",
      "label_input_codeAnalytics": "Google Analytics tracking code",
      "label_input_codeAnalytics_abbrTitle": "Useful to display a list of files and track the number of downloads",
      "label_input_queryOpt": "Query (for advanced users)",
      "label_input_download": "Allow viewers to download data as csv",
      "label_example_maps": "example",
      "label_example_gantt": "example",
      "label_example_bi": "example",
      "label_example_cards": "example",
      "label_example_sidebar": "example"
    }
  };
  var locale_fr = {
    config: {
      label_tab_sheet: 'Tableur',
      label_tab_view: 'Type de vue',
      label_tab_format: 'Options de format',
      label_tab_advanced_parameters: 'Paramètres avancés',
      button_save: 'Enregistrer',
      label_input_url: 'URL du tableur',
      label_input_sheet: 'Nom de la feuille',
      label_input_range: 'Plage de données',
      label_visualizationType_Table: 'Table',
      label_visualizationType_Table_abbrTitle: 'La vue par défaut, une vue simple type tableau / liste',
      label_visualizationType_Maps: 'Maps',
      label_visualizationType_Maps_abbrTitle: "Affiche les données sur une carte Google Maps, nécessite d'avoir des coordonnées géographiques / adresses pour chaque ligne",
      label_input_pageSize: "Nombre d'éléments à afficher",
      label_input_pageSize_abbrTitle: 'Le nombre de résultats à afficher par pages, les résultats étant paginés',
      label_input_columnsLayout: 'Nombre de colonnes',
      label_input_hasSidebar: 'Afficher des éléments dans une barre latérale',
      label_input_hasSidebar_abbrTitle: "Utile dès lors qu'une colonne du tableur contient beaucoup de données à afficher",
      label_input_sidebarColumn: 'Colonne contenant les données à afficher dans la barre latérale',
      label_input_categoryCaption: 'Le texte par défaut à afficher pour les listes déroulantes',
      value_input_categoryCaption: 'Choisir une valeur...',
      label_input_backgroundColor: 'Couleur de fond de la page',
      "label_input_dateFormat": "Format de date",
      label_input_customCSS: 'Custom CSS (url)',
      label_input_codeAnalytics: 'Code de tracking Google Analytics',
      label_input_codeAnalytics_abbrTitle: 'Utile pour afficher une liste de fichiers et tracker le nombre de téléchargements',
      label_input_queryOpt: 'Query (utilisateurs experts)',
      label_input_download: 'Autoriser le téléchargement des données au format CSV',
      label_example_maps: 'exemple',
      label_example_gantt: 'exemple',
      label_example_bi: 'exemple',
      label_example_cards: 'exemple',
      label_example_sidebar: 'exemple'
    }
  };
  var locale_it = {
    config: {
      "label_tab_sheet": "Foglio",
      "label_tab_view": "Vista",
      "label_tab_format": "Formato",
      "label_tab_advanced_parameters": "Parametri avanzati",
      "button_save": "Salva",
      "label_input_url": "Google Sheet URL",
      "label_input_sheet": "Nome del foglio",
      "label_input_range": "Intervallo",
      "label_visualizationType_Table": "Tabella",
      "label_visualizationType_Table_abbrTitle": "Vista di default",
      "label_visualizationType_Maps": "Mappe",
      "label_visualizationType_Maps_abbrTitle": "Visualizza i dati su Google Maps, richiede le coordinate geografiche o l'indirizzo per ciascuna riga",
      "label_input_pageSize": "Numeri di elementi da visualizzare",
      "label_input_pageSize_abbrTitle": "Numero di righe da visualizzare per pagina (i risultati vengono impaginati)",
      "label_input_columnsLayout": "Numero di colonne",
      "label_input_hasSidebar ": "Visualizza i dati in una sidebar",
      "label_input_hasSidebar_abbrTitle": "Utile quando si ha bisogno di visualizzare molti dati",
      "label_input_sidebarColumn": "Indice di colonna",
      "label_input_categoryCaption": "Testo da visualizzare nel filtro della categoria quando non ci sono elementi selezionati",
      "value_input_categoryCaption": "Scegli un valore...",
      "label_input_backgroundColor": "Colore di sfondo della pagina",
      "label_input_dateFormat": "Date format",
      "label_input_customCSS": "Custom CSS (url)",
      "label_input_codeAnalytics": "Codice di monitoraggio di Google Analytics",
      "label_input_codeAnalytics_abbrTitle": "Utile per visualizzare un elenco di file e monitorare il numero di download",
      "label_input_queryOpt": "Query (per utenti avanzati)",
      "label_input_download": "Permetti ai visualizzatori di scaricare i dati nel formato CSV",
      "label_example_maps": "esempio",
      "label_example_gantt": "esempio",
      "label_example_bi": "esempio",
      "label_example_cards": "esempio",
      "label_example_sidebar": "esempio"
    }
  };
  var locale_ru = {
    config: {
      "label_tab_sheet": "Лист",
      "label_tab_view": "Вид",
      "label_tab_format": "Формат",
      "label_tab_advanced_parameters": "Дополнительные параметры",
      "button_save": "Сохранить",
      "label_input_url": "Веб-ссылка на Google Таблицу",
      "label_input_sheet": "Имя листа в таблице",
      "label_input_range": "Диапазон",
      "label_visualizationType_Table": "Таблица",
      "label_visualizationType_Table_abbrTitle": "Вид по умолчанию",
      "label_visualizationType_Maps": "Карты",
      "label_visualizationType_Maps_abbrTitle": "Отображает данные на Картах Google, для корректной работы требуются данные в формате гео-координат или адреса для каждой строки",
      "label_input_pageSize": "Количество отображаемых элементов",
      "label_input_pageSize_abbrTitle": "Результаты выведены постранично",
      "label_input_columnsLayout": "Количество столбцов",
      "label_input_hasSidebar ": "Отображать данные на боковой панели",
      "label_input_hasSidebar_abbrTitle": "Пригодится, когда нужно вывести большой объем данных",
      "label_input_sidebarColumn": "Номер столбца",
      "label_input_categoryCaption": "Заголовок, отображаемый внутри фильтра по категориям, когда элементы не выбраны",
      "value_input_categoryCaption": "Выберите значение...",
      "label_input_backgroundColor": "Цвет заднего фона вашей страницы",
      "label_input_dateFormat": "Date format",
      "label_input_customCSS": "Пользовательский CSS файл (веб-ссылка)",
      "label_input_codeAnalytics": "Трекинг код Google Analytics",
      "label_input_codeAnalytics_abbrTitle": "Может быть использован для отображения списка файлов и отслеживания количества закачек",
      "label_input_queryOpt": "Query (пользовательский запрос, для продвинутых пользователей)",
      "label_input_download": "Разрешить читателям скачивать данные в CSV формате",
      "label_example_maps": "пример",
      "label_example_gantt": "пример",
      "label_example_bi": "пример",
      "label_example_cards": "пример",
      "label_example_sidebar": "пример"
    }
  };
  var locale_iw = {
    config: {
      "label_tab_sheet": "גיליון",
      "label_tab_view": "תצוגה",
      "label_tab_format": "פורמט",
      "label_tab_advanced_parameters": "הגדרות מתקדמות",
      "button_save": "שמור",
      "label_input_url": "קישור לגיליון",
      "label_input_sheet": "שם לשונית",
      "label_input_range": "טווח",
      "label_visualizationType_Table": "טבלה",
      "label_visualizationType_Table_abbrTitle": "תצוגת ברירת מחדל",
      "label_visualizationType_Maps": "מפה",
      "label_visualizationType_Maps_abbrTitle": "הצגת נתונים על גבי מפה דורשת נ.צ. או כתובת לכל שורה",
      "label_input_pageSize": "כמות שורות לתצוגה",
      "label_input_pageSize_abbrTitle": "תוצאות מוצגות בחלוקה לדפים",
      "label_input_columnsLayout": "כמות עמודות",
      "label_input_hasSidebar ": "הצג נתונים בפנל צדדי",
      "label_input_hasSidebar_abbrTitle": "שימושי במקרים שיש להציג כמות גדולה של נתונים",
      "label_input_sidebarColumn": "מספר עמודה",
      "label_input_categoryCaption": "כותרת שמוצגת בסנן כאשר לא נבחר שום ערך",
      "value_input_categoryCaption": "בחר ערך",
      "label_input_backgroundColor": "רקע של העמוד",
      "label_input_dateFormat": "Date format",
      "label_input_customCSS": "קובץ CSS חיצוני (קישור)",
      "label_input_codeAnalytics": "קוד מעקב Google Analytics",
      "label_input_codeAnalytics_abbrTitle": "ניתן לשימוש לתצוגה של רשימת קבצים ומעקב אחרי מספר הורדות",
      "label_input_queryOpt": "שאילתה",
      "label_input_download": "לאשר לצופים להוריד מידע כ- csv",
      "label_example_maps": "example",
      "label_example_gantt": "example",
      "label_example_bi": "example",
      "label_example_cards": "example",
      "label_example_sidebar": "example"
    }
  };
  var locale_es = {
    config: {
      "label_tab_sheet": "Hoja",
      "label_tab_view": "Ver",
      "label_tab_format": "Formato",
      "label_tab_advanced_parameters": "Parametroz avanzados",
      "button_save": "Guardar",
      "label_input_url": "Enlace de la Hoja de Calculo de Google",
      "label_input_sheet": "Nombre de la hoja de calculo",
      "label_input_range": "Rango",
      "label_visualizationType_Table": "Tabla",
      "label_visualizationType_Table_abbrTitle": "Vista predeterminada",
      "label_visualizationType_Maps": "Mapas",
      "label_visualizationType_Maps_abbrTitle": "Mostrar los datos en Google Maps, requiere georeferenciamiento / direcciones para cada linea de la hoja de calculo",
      "label_input_pageSize": "Número de items a mostrar",
      "label_input_pageSize_abbrTitle": "Los resultados estan paginados",
      "label_input_columnsLayout": "Número de columnas",
      "label_input_hasSidebar ": "Mostrar los datos en la barra vertical",
      "label_input_hasSidebar_abbrTitle": "Util cuando deseas mostrar muchos datos",
      "label_input_sidebarColumn": "Columna de indexación",
      "label_input_categoryCaption": "Información que se muestra dentro de cada categoria cuando no es seleccionado ningún item",
      "value_input_categoryCaption": "Elegir valor...",
      "label_input_backgroundColor": "Color de fondo de la pagina",
      "label_input_dateFormat": "Date format",
      "label_input_customCSS": "CSS Personalizado (enlace)",
      "label_input_codeAnalytics": "Codigo de monitoreo de Google Anaytics",
      "label_input_codeAnalytics_abbrTitle": "Util para mostrar una lista de archivos y monitorear el número de descargas",
      "label_input_queryOpt": "Pregunta (Para usuarios avanzados)",
      "label_input_download": "Permite descargar los datos como csv",
      "label_example_maps": "example",
      "label_example_gantt": "example",
      "label_example_bi": "example",
      "label_example_cards": "example",
      "label_example_sidebar": "example"
    }
  };
  var locale_pt = {
    config: {
      "label_tab_sheet": "Planilha",
      "label_tab_view": "Visão",
      "label_tab_format": "Formato",
      "label_tab_advanced_parameters": "Parametros avançados",
      "button_save": "Salvar",
      "label_input_url": "URL Google Planilha",
      "label_input_sheet": "Nome da planilha",
      "label_input_range": "Intervalo",
      "label_visualizationType_Table": "Tabela",
      "label_visualizationType_Table_abbrTitle": "Visão padrão",
      "label_visualizationType_Maps": "Mapas",
      "label_visualizationType_Maps_abbrTitle": "Mostar dados no Google Mapas. Requer coordenadas geográficas / endereço para cada linha de dado.",
      "label_input_pageSize": "Número de item a mostrar",
      "label_input_pageSize_abbrTitle": "Resultados estão paginados",
      "label_input_columnsLayout": "Número de colunas",
      "label_input_hasSidebar ": "Mostrar os dados na barra lateral",
      "label_input_hasSidebar_abbrTitle": "Útil quando você precisa exibir grande quantidade de dados.",
      "label_input_sidebarColumn": "Índice de coluna",
      "label_input_categoryCaption": "Legenda para exibir dentro do filtro categoria quando nenhum item é selecionado",
      "value_input_categoryCaption": "Selecione valor...",
      "label_input_backgroundColor": "Cor de fundo da sua página",
      "label_input_dateFormat": "Date format",
      "label_input_customCSS": "CSS customizado (url)",
      "label_input_codeAnalytics": "Código de rastreamente do Google Analytics",
      "label_input_codeAnalytics_abbrTitle": "Útil para mostrar uma lista de arquivos e rastrear o número de downloads",
      "label_input_queryOpt": "Consulta (para usuários avançados)",
      "label_input_download": "Permite visualizadores fazerem download no formato csv",
      "label_example_maps": "exemplo",
      "label_example_gantt": "exemplo",
      "label_example_bi": "exemplo",
      "label_example_cards": "exemplo",
      "label_example_sidebar": "exemplo"
    }
  };
  var locale_nl = {
    config: {
      "label_tab_sheet": "Tabblad",
      "label_tab_view": "Beeld",
      "label_tab_format": "Formaat",
      "label_tab_advanced_parameters": "Geavanceerde instellingen",
      "button_save": "Opslaan",
      "label_input_url": "Google Spreadsheet URL",
      "label_input_sheet": "Tabbladnaam",
      "label_input_range": "Bereik",
      "label_visualizationType_Table": "Tabel",
      "label_visualizationType_Table_abbrTitle": "Standaard beeldinstelling",
      "label_visualizationType_Maps": "Kaarten",
      "label_visualizationType_Maps_abbrTitle": "Laat de gegevens op een Google Map zien (geo-coordinaten / adresgegevens nodig)",
      "label_input_pageSize": "Aantal items om te laten zien",
      "label_input_pageSize_abbrTitle": "De resultaten zijn gepagineerd",
      "label_input_columnsLayout": "Aantal kolommen",
      "label_input_hasSidebar ": "Laat de resultaten in de zijbalk zien",
      "label_input_hasSidebar_abbrTitle": "Handig wanneer je grote hoeveelheden gegevens moet laten zien",
      "label_input_sidebarColumn": "Kolomindex",
      "label_input_categoryCaption": "Het bijschrift die wordt getoond, wanneer je geen item hebt geselecteerd",
      "value_input_categoryCaption": "Kies een waarde...",
      "label_input_backgroundColor": "De achtergrondkleur van je pagina",
      "label_input_dateFormat": "Date format",
      "label_input_customCSS": "Gepersonaliseerde CSS (URL)",
      "label_input_codeAnalytics": "Google Analytics tracking code",
      "label_input_codeAnalytics_abbrTitle": "Handig voor een lijst en het bijhouden van het aantal downloads",
      "label_input_queryOpt": "Zoekterm (voor gevorderden)",
      "label_input_download": "Toestaan voor gebruikers om data als CSV bestand te downloaden ",
      "label_example_maps": "voorbeeld",
      "label_example_gantt": "voorbeeld",
      "label_example_bi": "voorbeeld",
      "label_example_cards": "voorbeeld",
      "label_example_sidebar": "voorbeeld"
    }
  };
  var locale_no = {
    config: {
      "label_tab_sheet": "Ark",
      "label_tab_view": "Visning",
      "label_tab_format": "Format",
      "label_tab_advanced_parameters": "Avanserte innstillinger",
      "button_save": "Lagre",
      "label_input_url": "Google Regneark URL",
      "label_input_sheet": "Arknavn",
      "label_input_range": "Område",
      "label_visualizationType_Table": "Tabell",
      "label_visualizationType_Table_abbrTitle": "Standard innstilling",
      "label_visualizationType_Maps": "Kart",
      "label_visualizationType_Maps_abbrTitle": "Vis data i Google Maps, krever geo koordinater/ adresser for hver rad",
      "label_input_pageSize": "Antall enheter som skal vises",
      "label_input_pageSize_abbrTitle": "Resultatet er i sidevisning",
      "label_input_columnsLayout": "Antall kolonner",
      "label_input_hasSidebar ": "Vis data i sidefelt",
      "label_input_hasSidebar_abbrTitle": "Nyttig når du behøver å vise mye data",
      "label_input_sidebarColumn": "Kolonne indeks",
      "label_input_categoryCaption": "Data som skal vises i kategori filteret når ingen enheter er valgt",
      "value_input_categoryCaption": "Velg en verdi...",
      "label_input_backgroundColor": "Bakgrunnsfarge på siden din",
      "label_input_dateFormat": "Date format",
      "label_input_customCSS": "Tilpasset CSS (URL)",
      "label_input_codeAnalytics": "Google Analytics sporingskode",
      "label_input_codeAnalytics_abbrTitle": "Nyttig å vise en liste av filer og følge antall nedlastninger",
      "label_input_queryOpt": "Spørring (for avanserte brukere)",
      "label_input_download": "Tillat tilskuere å laste ned data som csv",
      "label_example_maps": "eksempel",
      "label_example_gantt": "eksempel",
      "label_example_bi": "eksempel",
      "label_example_cards": "eksempel",
      "label_example_sidebar": "eksempel"
    }
  };
  var locale_hi = {
    config: {
      "label_tab_sheet": "पत्रक (शीट)",
      "label_tab_view": "दृष्य (व्यू)",
      "label_tab_format": "फ़ोर्मेट",
      "label_tab_advanced_parameters": "उन्नत प्राचल (अेडव्हान्सड पेरामिटर्स)",
      "button_save": "सहेजे (सेव्ह)",
      "label_input_url": "गुगल शीट्कि यु आर एल",
      "label_input_sheet": "पत्रक (शीटका) नाम",
      "label_input_range": "सीमा (रेंज)",
      "label_visualizationType_Table": "तालिका",
      "label_visualizationType_Table_abbrTitle": "तयशुदा दृष्य (डीफौल्ट व्यू)",
      "label_visualizationType_Maps": "नक्शा",
      "label_visualizationType_Maps_abbrTitle": "डेटाको गुगल मैप्स  पर दिखाये, इस लिये हर डेटा पंक्तिका भू निर्देशांक / पता लगेगा",
      "label_input_pageSize": "कितने मद (आईटेम्स) दिखाये",
      "label_input_pageSize_abbrTitle": "परिणाम पृष्ठवार है",
      "label_input_columnsLayout": "स्तंभोकी संख्या",
      "label_input_hasSidebar ": "डेटाको साइड बारमे दिखाये",
      "label_input_hasSidebar_abbrTitle": "ज्यादा डेटाको दिखाते वक्त उपयोगी",
      "label_input_sidebarColumn": "स्तंभोकी अनुक्रमणिका",
      "label_input_categoryCaption": "जब श्रेणी / वर्ग फिल्टरमे कोई मद (आईटेम) नही चुना होगा तो दिखानेका कैप्शन",
      "value_input_categoryCaption": "मान (वैल्यू) का चयन करे…",
      "label_input_backgroundColor": "आपके पन्नेकि पृष्ठभूमीका रंग",
      "label_input_dateFormat": "Date format",
      "label_input_customCSS": "ऐच्छिक सी एस एस",
      "label_input_codeAnalytics": "गुगल एनालिटिक्स ट्रैकिंग कोड",
      "label_input_codeAnalytics_abbrTitle": "फाइलोंकि सूची दिखाने तथा डाउनलोड्स कि संख्या जाननेमे उपयोगी",
      "label_input_queryOpt": "प्रश्न [उन्नत (अेडव्हान्सड) प्रयोगकर्ताओके लिये]",
      "label_input_download": "दर्शकोंको डेटा सी एस व्ही रूप मे डाउनलोड करने कि इजाजत दें",
      "label_example_maps": "उदाहरण",
      "label_example_gantt": "उदाहरण",
      "label_example_bi": "उदाहरण",
      "label_example_cards": "उदाहरण",
      "label_example_sidebar": "उदाहरण"
    }
  };
  var locale_de = {
    config: {
      "label_tab_sheet": "Tabelle",
      "label_tab_view": "Ansicht",
      "label_tab_format": "Format",
      "label_tab_advanced_parameters": "erweiterte Einstellungen",
      "button_save": "Speichern",
      "label_input_url": "Google Sheet URL",
      "label_input_sheet": "Name der Spreadsheet",
      "label_input_range": "Bereich",
      "label_visualizationType_Table": "Tabelle",
      "label_visualizationType_Table_abbrTitle": "Standardansicht",
      "label_visualizationType_Maps": "Maps",
      "label_visualizationType_Maps_abbrTitle": "Um Daten mittels Google Maps anzuzeigen werden in jeder Zeile Geo-Koordinaten oder konkrete Adressen benötigt",
      "label_input_pageSize": "Anzahl anzuzeigender Elemente",
      "label_input_pageSize_abbrTitle": "Ergebnisse sind nummeriert",
      "label_input_columnsLayout": "Anzahl Spalten",
      "label_input_hasSidebar ": "Daten in Sidebar anzeigen",
      "label_input_hasSidebar_abbrTitle": "Sinnvoll, wenn viele Daten angezeigt werden sollen",
      "label_input_sidebarColumn": "Spalten-Index",
      "label_input_categoryCaption": "Filterbeschriftung, wenn keine Kategorie ausgewählt ist",
      "value_input_categoryCaption": "Wert wählen...",
      "label_input_backgroundColor": "Hintergrundfarbe für Seite",
      "label_input_dateFormat": "Date format",
      "label_input_customCSS": "Individuelle CSS (url)",
      "label_input_codeAnalytics": "Google Analytics tracking code",
      "label_input_codeAnalytics_abbrTitle": "Sinnvoll, wenn Dateien und Anzahl der Downloads gemessen werden sollen",
      "label_input_queryOpt": "Query (für fortgeschrittene Nutzer)",
      "label_input_download": "Betrachtern das herunterladen als .csv erlauben",
      "label_example_maps": "Beispiel",
      "label_example_gantt": "Beispiel",
      "label_example_bi": "Beispiel",
      "label_example_cards": "Beispiel",
      "label_example_sidebar": "Beispiel"
    }
  };
  var locale_ja = {
    config: {
      "label_tab_sheet": "スプレッドシート",
      "label_tab_view": "表示",
      "label_tab_format": "フォーマット",
      "label_tab_advanced_parameters": "高度な設定",
      "button_save": "保存",
      "label_input_url": "Google スプレッドシートのURL",
      "label_input_sheet": "シート名",
      "label_input_range": "範囲",
      "label_visualizationType_Table": "テーブル",
      "label_visualizationType_Table_abbrTitle": "デフォルト",
      "label_visualizationType_Maps": "マップ",
      "label_visualizationType_Maps_abbrTitle": "Googleマップに表示するには、各行に緯度経度 / 住所が必要です。",
      "label_input_pageSize": "表示する行数",
      "label_input_pageSize_abbrTitle": "分割して表示されます。",
      "label_input_columnsLayout": "列の数",
      "label_input_hasSidebar ": "サイドバーにデータを表示",
      "label_input_hasSidebar_abbrTitle": "データ量が多い場合に使用してください。",
      "label_input_sidebarColumn": "列のインデックス",
      "label_input_categoryCaption": "カテゴリーフィルダで、アイテムが選択されていない場合の表示",
      "value_input_categoryCaption": "選択してください...",
      "label_input_backgroundColor": "ページの背景色",
      "label_input_dateFormat": "Date format",
      "label_input_customCSS": "カスタムCSS (url)",
      "label_input_codeAnalytics": "Google Analytics トラッキングコード",
      "label_input_codeAnalytics_abbrTitle": "ファイルリストの表示、ダウンロード数の記録に使用してください。",
      "label_input_queryOpt": "クエリ（高度なユーザ向け）",
      "label_input_download": "閲覧者にCSVのダウンロードを許可する",
      "label_example_maps": "例",
      "label_example_gantt": "例",
      "label_example_bi": "例",
      "label_example_cards": "例",
      "label_example_sidebar": "例"
    }
  };
  var locale_cs = {
    config: {
      "label_tab_sheet": "Tabulka",
      "label_tab_view": "Zobrazení",
      "label_tab_format": "Formát",
      "label_tab_advanced_parameters": "Pokročilé parametry",
      "button_save": "Uložit",
      "label_input_url": "URL Tabulky Google",
      "label_input_sheet": "Název listu",
      "label_input_range": "Oblast",
      "label_visualizationType_Table": "Tabulka",
      "label_visualizationType_Table_abbrTitle": "Výchozí zobrazení",
      "label_visualizationType_Maps": "Mapy",
      "label_visualizationType_Maps_abbrTitle": "Zobrazí data v Mapě Google (vyžaduje souřadnice nebo adresu pro každý řádek)",
      "label_input_pageSize": "Zobrazený počet položek",
      "label_input_pageSize_abbrTitle": "Výsledky jsou stránkovány",
      "label_input_columnsLayout": "Počet sloupců",
      "label_input_hasSidebar ": "Zobrazit data v postranním panelu",
      "label_input_hasSidebar_abbrTitle": "Užitečné, pokud potřebujete zobrazit velké množství informací",
      "label_input_sidebarColumn": "Pořadí sloupce (index)",
      "label_input_categoryCaption": "Popis zobrazený ve filtru kategorií, když není vybrána žádná položka",
      "value_input_categoryCaption": "Vyberte hodnotu...",
      "label_input_backgroundColor": "Barva pozadí stránky",
      "label_input_dateFormat": "Date format",
      "label_input_customCSS": "Vlastní CSS (URL)",
      "label_input_codeAnalytics": "Měřící kód Google Analytics",
      "label_input_codeAnalytics_abbrTitle": "Užitečné např. pro sledování počtu stažení u seznamu souborů",
      "label_input_queryOpt": "Dotaz (Query - pro pokročilé uživatele)",
      "label_input_download": "Umožnit uživatelům stáhnout data v .csv",
      "label_example_maps": "ukázka",
      "label_example_gantt": "ukázka",
      "label_example_bi": "ukázka",
      "label_example_cards": "ukázka",
      "label_example_sidebar": "ukázka"
    }
  };
  var locale_zh_cn = {
    config: {
      "label_tab_sheet": "电子表格",
      "label_tab_view": "视图",
      "label_tab_format": "格式",
      "label_tab_advanced_parameters": "高级参数",
      "button_save": "保存",
      "label_input_url": "Google电子表格链接",
      "label_input_sheet": "电子表格名称",
      "label_input_range": "范围",
      "label_visualizationType_Table": "表",
      "label_visualizationType_Table_abbrTitle": "默认视图",
      "label_visualizationType_Maps": "地图",
      "label_visualizationType_Maps_abbrTitle": "在Google地图上显示数据，每个数据行需要地理坐标或地址",
      "label_input_pageSize": "需要显示的条目数",
      "label_input_pageSize_abbrTitle": "结果已分页",
      "label_input_columnsLayout": "列数",
      "label_input_hasSidebar ": "在侧栏显示数据",
      "label_input_hasSidebar_abbrTitle": "当你需要显示大量数据时有用",
      "label_input_sidebarColumn": "列索引",
      "label_input_categoryCaption": "当未选定条目时在目录过滤器内显示的标题",
      "value_input_categoryCaption": "选择一个值...",
      "label_input_backgroundColor": "页面背景色",
      "label_input_dateFormat": "Date format",
      "label_input_customCSS": "自定义CSS（链接）",
      "label_input_codeAnalytics": "Google Analytics跟踪代码",
      "label_input_codeAnalytics_abbrTitle": "对显示一个文件列表并跟踪下载数量有用",
      "label_input_queryOpt": "查询（针对高级用户）",
      "label_input_download": "允许查看者下载csv格式的数据",
      "label_example_maps": "示例",
      "label_example_gantt": "示例",
      "label_example_bi": "示例",
      "label_example_cards": "示例",
      "label_example_sidebar": "示例"
    }
  };
  var locale_ko = {
    config: {
      "label_tab_sheet": "시트",
      "label_tab_view": "뷰",
      "label_tab_format": "포맷",
      "label_tab_advanced_parameters": "고급 매개변수들",
      "button_save": "저장",
      "label_input_url": "구글 시트 URL",
      "label_input_sheet": "시트명",
      "label_input_range": "범위",
      "label_visualizationType_Table": "테이블",
      "label_visualizationType_Table_abbrTitle": "기본 뷰",
      "label_visualizationType_Maps": "지도들",
      "label_visualizationType_Maps_abbrTitle": "구글맵에 데이터를 표현합니다, 각각의 행에 입력할 지리적 좌표값과 주소가 필요합니다",
      "label_input_pageSize": "표현할 아이템들의 갯수",
      "label_input_pageSize_abbrTitle": "결과물들의 페이지가 매겨졌습니다",
      "label_input_columnsLayout": "열 갯수",
      "label_input_hasSidebar ": "사이드바의 데이터를 디스플레이 합니다",
      "label_input_hasSidebar_abbrTitle": "많은양의 데이터를 표현할 때 유용합니다",
      "label_input_sidebarColumn": "열 Index",
      "label_input_categoryCaption": "아무 아이템도 선택되지 않았을때 카테고리 필터 내부에 표시될 자막",
      "value_input_categoryCaption": "값을 선택하세요...",
      "label_input_backgroundColor": "페이지의 배경색",
      "label_input_dateFormat": "Date format",
      "label_input_customCSS": "커스텀 CSS (URL)",
      "label_input_codeAnalytics": "구글 분석기 트래킹 코드",
      "label_input_codeAnalytics_abbrTitle": "파일들이나 다운로드 횟수 추적 등의 리스트를 표현할 때 유용합니다",
      "label_input_queryOpt": "쿼리(고급 사용자용)",
      "label_input_download": "뷰어들이 데이터를 CSV로 다운로드 하도록 허락합니다",
      "label_example_maps": "예제",
      "label_example_gantt": "예제",
      "label_example_bi": "예제",
      "label_example_cards": "예제",
      "label_example_sidebar": "예제"
    }
  };
  var locale_pl = {
    config: {
      "label_tab_sheet": "Arkusz",
      "label_tab_view": "Widok",
      "label_tab_format": "Formatowanie",
      "label_tab_advanced_parameters": "Zaawansowane parametry",
      "button_save": "Zapisz",
      "label_input_url": "URL Arkusza Google",
      "label_input_sheet": "Nazwa arkusza",
      "label_input_range": "Zakres",
      "label_visualizationType_Table": "Tabela",
      "label_visualizationType_Table_abbrTitle": "Domyślny widok",
      "label_visualizationType_Maps": "Mapy",
      "label_visualizationType_Maps_abbrTitle": "Wyświetla dane na Mapach Google, wymaga geokoordynatów/adresów dla każdego z wierszy z danymi",
      "label_input_pageSize": "Liczba elementów do wyświetlenia",
      "label_input_pageSize_abbrTitle": "Wyniki będą paginowane",
      "label_input_columnsLayout": "Liczba kolumn",
      "label_input_hasSidebar ": "Wyświetl dane w panelu bocznym",
      "label_input_hasSidebar_abbrTitle": "Pozwala na wyświetlenie dużej ilości danych",
      "label_input_sidebarColumn": "Indeks kolumny",
      "label_input_categoryCaption": "Podpis wyświetlany wewnątrz filtra kategorii, jeżeli nie wybrano żadnego elementu",
      "value_input_categoryCaption": "Wybierz wartość...",
      "label_input_backgroundColor": "Kolor tła Twojej strony",
      "label_input_dateFormat": "Date format",
      "label_input_customCSS": "Własny CSS (URL)",
      "label_input_codeAnalytics": "Kod śledzenia (Google Analytics)",
      "label_input_codeAnalytics_abbrTitle": "Pozwala na wyświetlenie listy plików i śledzenie liczby pobrań",
      "label_input_queryOpt": "Zapytanie (query - dla zaawansowanych)",
      "label_input_download": "Pozwól oglądającym na pobranie danych w formacie CSV",
      "label_example_maps": "przykład",
      "label_example_gantt": "przykład",
      "label_example_bi": "przykład",
      "label_example_cards": "przykład",
      "label_example_sidebar": "przykład"
    }
  };
  var html = '<ul class="nav nav-tabs col-xs-11"><li class="active"><a href="#tab_sheet" id="label_tab_sheet" data-toggle="tab"></a></li><li><a href="#tab_view" id="label_tab_view" data-toggle="tab"></a></li><li><a href="#tab_format" id="label_tab_format" data-toggle="tab"></a></li><li><a href="#tab_advanced_parameters" id="label_tab_advanced_parameters" data-toggle="tab"></a></li><li><a href="http://goo.gl/2f0bX" target="_blank"><span class="glyphicon glyphicon-question-sign"></span></a></li><li><button type="button" class="btn btn-success" id="button_save" onclick="savePrefs();"></button></li></ul><div class="tab-content col-xs-11"><div class="tab-pane fade in active" id="tab_sheet"><form class="form-horizontal" role="form"><br><div class="form-group"><label for="url" class="col-xs-3 control-label" id="label_input_url"></label><div class="col-xs-8"><input class="form-control" id="url" placeholder="Enter url"></div></div><div class="form-group"><label for="sheet" class="col-xs-3 control-label" id="label_input_sheet"></label><div class="col-xs-8"><input class="form-control" id="sheet" value="Sheet1"></div></div><div class="form-group"><label for="range" class="col-xs-3 control-label" id="label_input_range"></label><div class="col-xs-8"><input class="form-control" id="range" value="A1:H"></div></div></form></div><div class="tab-pane fade" id="tab_view"><div class="row"><br><div class="col-xs-6"><div class="radio"><label><input type="radio" name="visualizationType" id="visualizationType_Table" onchange="handleChange_visualizationType(this);" value="Table" checked><b><abbr id="label_visualizationType_Table" data-toggle="tooltip"></abbr></b></label></div><div class="radio"><label><input type="radio" name="visualizationType" id="visualizationType_Maps" onchange="handleChange_visualizationType(this);" value="Maps"><b><abbr id="label_visualizationType_Maps" data-toggle="tooltip"></abbr></b> - <a href="http://goo.gl/gC8cxW" target="_blank" id="label_example_maps"></a></label></div><div class="radio"><label><input type="radio" name="visualizationType" id="visualizationType_Gantt" onchange="handleChange_visualizationType(this);" value="Gantt"><b> Gantt </b> - <a href="http://goo.gl/pgiCSf" target="_blank" id="label_example_gantt"></a></label></div><div class="radio"><label><input type="radio" name="visualizationType" id="visualizationType_BI" onchange="handleChange_visualizationType(this);" value="BI"><b> Advanced summary of responses </b><br>(for Google Forms) - <a href="http://goo.gl/U09c6I" target="_blank" id="label_example_bi"></a></label></div><div class="radio"><label><input type="radio" name="visualizationType" id="visualizationType_Cards" onchange="handleChange_visualizationType(this);" value="Cards"><b> Cards </b> - <a href="http://goo.gl/DeXoDW" target="_blank" id="label_example_cards"></a></label></div></div><div class="col-xs-6"><form class="form-horizontal" role="form"><div class="form-group" id="container_pageSize"><label for="pageSize" class="col-xs-8 control-label"><abbr id="label_input_pageSize" data-toggle="tooltip"></abbr></label><div class="col-xs-3"><input class="form-control" id="pageSize" value=15></div></div><div class="form-group" id="container_columnsLayout"><label for="columnsLayout" class="col-xs-8 control-label" id="label_input_columnsLayout"></label><div class="col-xs-3"><input class="form-control" id="columnsLayout" value=2></div></div><div class="checkbox" id="container_hasSidebar"><label><input type="checkbox" id="hasSidebar" onchange="toggleInputDisplay_sidebarColumn();"><abbr id="label_input_hasSidebar" data-toggle="tooltip"></abbr><a href="http://goo.gl/zL3izE" target="_blank" id="label_example_sidebar"></a></label></div><div class="form-group" id="container_sidebarColumn"><label for="sidebarColumn" class="col-xs-8 control-label" id="label_input_sidebarColumn"></label><div class="col-xs-3"><input class="form-control" id="sidebarColumn" value="A"></div></div></form></div></div></div><div class="tab-pane fade" id="tab_format"><form class="form-horizontal" role="form"><br><div class="form-group"><label for="categoryCaption" class="col-xs-4 control-label" id="label_input_categoryCaption"></label><div class="col-xs-7"><input class="form-control" id="categoryCaption" value="__MSG_Category_Caption__"></div></div><div class="form-group"><label for="backgroundColor" class="col-xs-4 control-label" id="label_input_backgroundColor"></label><div class="col-xs-7"><input class="form-control" id="backgroundColor" value="white"></div></div><div class="form-group"><label for="dateFormat" class="col-xs-4 control-label" id="label_input_dateFormat"></label><div class="col-xs-7"><select class="form-control" id="dateFormat"><option>MM/dd/yy</option><option>MM/dd/yyyy</option><option>dd/MM/yy</option><option>dd/MM/yyyy</option><option>MM/yy</option><option>MM/yyyy</option></select></div></div><div class="form-group"><label for="customCSS" class="col-xs-4 control-label" id="label_input_customCSS"></label><div class="col-xs-7"><input class="form-control" id="customCSS"></div></div></form></div><div class="tab-pane fade" id="tab_advanced_parameters"><form class="form-horizontal" role="form"><br><div class="form-group"><label for="codeAnalytics" class="col-xs-4 control-label"><abbr id="label_input_codeAnalytics" data-toggle="tooltip"></abbr></label><div class="col-xs-7"><input class="form-control" id="codeAnalytics"></div></div><div class="form-group"><label for="queryOpt" class="col-xs-4 control-label" id="label_input_queryOpt"></label><div class="col-xs-7"><input class="form-control" id="queryOpt"></div></div><div class="checkbox"><label><input type="checkbox" id="download"><div id="label_input_download"></div></label></div></form></div></div>';
  document.getElementById("config_panel").innerHTML = html;
  if (lang == 'FR') var locale = locale_fr;
  else if (lang == 'IT') var locale = locale_it;
  else if (lang == 'RU') var locale = locale_ru;
  else if (lang == 'IW') var locale = locale_iw;
  else if (lang == 'ES') var locale = locale_es;
  else if (lang == 'PT') var locale = locale_pt;
  else if (lang == 'NL') var locale = locale_nl;
  else if (lang == 'NO') var locale = locale_no;
  else if (lang == 'HI') var locale = locale_hi;
  else if (lang == 'DE') var locale = locale_de;
  else if (lang == 'JA') var locale = locale_ja;
  else if (lang == 'CS') var locale = locale_cs;
  else if (lang == 'zh-CN') var locale = locale_zh_cn;
  else if (lang == 'KO') var locale = locale_ko;
  else if (lang == 'PL') var locale = locale_pl;
  else var locale = locale_en;
  for (i in locale.config) {
    if (i.indexOf('_abbrTitle') != -1) $('#' + i.replace('_abbrTitle', '')).prop('title', locale.config[i]);
    else if (i.indexOf('value_input_') != -1) $('#' + i.replace('value_input_', '')).val(locale.config[i]);
    else $('#' + i).text(locale.config[i]);
  }
  if (prefs.getString('url') != '') $('#url').val(prefs.getString('url'));
  if (prefs.getString('sheet') != '') $('#sheet').val(prefs.getString('sheet'));
  if (prefs.getString('range') != '') $('#range').val(prefs.getString('range'));
  if (prefs.getString('pageSize') != '') $('#pageSize').val(prefs.getString('pageSize'));
  if (prefs.getString('categoryCaption') != '') $('#categoryCaption').val(prefs.getString('categoryCaption'));
  if (prefs.getString('backgroundColor') != '') $('#backgroundColor').val(prefs.getString('backgroundColor'));
  if (prefs.getString('customCSS') != '') $('#customCSS').val(prefs.getString('customCSS'));
  if (prefs.getString('dateFormat') != '') $('#dateFormat').val(prefs.getString('dateFormat'));
  if (prefs.getString('codeAnalytics') != '') $('#codeAnalytics').val(prefs.getString('codeAnalytics'));
  var visualizationType = prefs.getString('visualizationType');
  if (visualizationType == '') visualizationType = 'Table';
  var queryOpt = prefs.getString('queryOpt');
  queryOpt = queryOpt.replace(/&#39;/g, '\'').replace(/&#34;/g, '\'').replace(/&#60;/g, '<').replace(/&#62;/g, '>');
  if (queryOpt.indexOf('columnsLayout ') != -1) {
    var columnsLayout = queryOpt.split('columnsLayout ')[1].split(' ')[0];
    $('#columnsLayout').val(columnsLayout);
    visualizationType = 'Cards';
    queryOpt = queryOpt.replace(' columnsLayout ' + columnsLayout, '');
  }
  $("#visualizationType_" + visualizationType).attr('checked', true);
  handleChange_visualizationType({
    value: visualizationType
  });
  toggleInputDisplay_sidebarColumn();
  if (prefs.getString('queryOpt') != '') $('#queryOpt').val(queryOpt);
  if (prefs.getBool('download')) $('#download').attr('checked', true);
}

function handleChange_visualizationType(e) {
  if (e.value != 'Table' && e.value != 'Cards') $("#container_pageSize").hide();
  else $("#container_pageSize").show();
  // For now on, sidebar option isn't displayed
  $("#container_hasSidebar").hide();
  $("#container_sidebarColumn").hide();
  if (e.value != 'Cards') {
    $("#container_columnsLayout").hide();
    if ($('#customCSS').val() == customCSSForCards) $('#customCSS').val('');
  }
  else {
    $("#container_columnsLayout").show();
    if ($('#customCSS').val() == '') $('#customCSS').val(customCSSForCards);
  }
}

function toggleInputDisplay_sidebarColumn() {
  if ($('#hasSidebar').prop('checked')) $("#container_sidebarColumn").show();
  else $("#container_sidebarColumn").hide();
}

function savePrefs() {
  $('.btn').button('loading');
  setTimeout(function () {
    $('.btn').button('reset');
  }, 1000);
  prefs.set('url', $('#url').val());
  prefs.set('sheet', $('#sheet').val());
  prefs.set('range', $('#range').val());
  var visualizationType = $('input[name=visualizationType]:checked').val();
  prefs.set('visualizationType', visualizationType);
  if ($('#pageSize').val() != '') prefs.set('pageSize', $('#pageSize').val());
  if ($('#categoryCaption').val() != '') prefs.set('categoryCaption', $('#categoryCaption').val());
  if ($('#backgroundColor').val() != '') prefs.set('backgroundColor', $('#backgroundColor').val());
  prefs.set('dateFormat', $('#dateFormat').val());
  var queryOpt = $('#queryOpt').val();
  if (visualizationType == 'Cards') {
    queryOpt += ' columnsLayout ' + $('#columnsLayout').val();
    prefs.set('visualizationType', 'Table');
  }
  prefs.set('queryOpt', queryOpt);
  prefs.set('codeAnalytics', $('#codeAnalytics').val());
  prefs.set('download', $('#download').prop('checked'));
  prefs.set('customCSS', $('#customCSS').val());
}
gadgets.util.registerOnLoadHandler(displayParameters);